﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Parylene_CVD.Tools
{
    public class CheckIPAdress
    {
        /// <summary>
        /// 检查IP地址是否为有效的IPv4地址
        /// </summary>
        public static bool IsValidIPAddress(string ipAddress)
        {
            // IPv4正则表达式
            string pattern = @"^((25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)$";
            return System.Text.RegularExpressions.Regex.IsMatch(ipAddress, pattern);
        }
    }
}
